{% extends 'Base.html' %}
{% load staticfiles %}
{% load compress %}
{% block main %}
    <div style="margin-top: 10px;background-color: white">
        <form class="layui-form layui-form-pane" method="post">
            {#编辑器内容,用户信息#}
            <input style="display: none" type="number" name="article_id" value="{{ article_id }}">

            <div class="layui-form-item" pane>
                <span class="layui-form-label" style="text-align: center">
                    文章标题
                </span>
                <div class="layui-input-block">
                    <input type="text" placeholder="请输入标题......" name="article_title" lay-verify="required"
                           class="layui-input"
                           value="{{ title }}" autocomplete="off">
                </div>
            </div>
            <div class="layui-form">
                <div class="layui-form-item">
                    <textarea id="bbd-layedit">{{ content }}</textarea>
                </div>
            </div>

            {#        信息提示框#}
            <div id="message" class="alert alert-warning alert-dismissable" style="display: none">
            </div>
            <div class="layui-form-item" pane ng-controller="categories">

                <span class="layui-form-label">分类</span>
                <div class="layui-input-block">

                    <select name="article_category" id="article_category2">
                        {% if category %}
                            <option id="bbd-edit-{{ category.0 }}" value="{{ category.0 }}">{{ category.1 }}</option>
                        {% else %}
                            <option value="">搜索或选择文章分类</option>
                        {% endif %}
                        {% for category in categories %}
                            {{ category.id }}
                            <option value={{ category.id }}>{{ category.assortment }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="layui-form-item" pane>
                <span class="layui-form-label">标签</span>
                <div class="layui-input-block">
                    <input class="layui-input" type="text" name="article_tag"
                           placeholder="例如：Python,Django,Flask,BootStrap" autocomplete="off" lay-verify="required"
                           value="{{ tag }}">
                </div>
            </div>
            <div style="display: none" id="edit_message">wwqwqw</div>
            <div class="layui-form-item">
                <div>
                    <button class="layui-btn" lay-submit lay-filter="article_edit" id="edit_submit">立即提交</button>
                </div>
            </div>
        </form>

    </div>

    {#layui编辑器#}
    <script src="{% static 'js/lib/tinymce/tinymce.min.js' %}"></script>
    {#编辑器js文件#}
    {% compress js %}
        <script type="text/javascript" src="{% static '/js/article_edit.js' %}"></script>
    {% endcompress %}
{% endblock %}